package org.jgs1904.practice;

import java.util.Scanner;

/**
 * @author: 默苍璃
 * @date: 2022-09-09 11:36
 * <p>
 * 使用do while循环计算从m到n的和。
 */
public class DoWhile {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("输入第一个数:");
        int one = scanner.nextInt();
        System.out.println("输入第二个数:");
        int tow = scanner.nextInt();

        //方法二
        int sum1 = 0;
        do {
            sum1 += one;
            one++;
        } while (one <= tow);

        System.out.println(sum1);

        scanner.close();
    }
}
